<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../js/vue.js"></script>
    <title>Document</title>
</head>
<!-- 

    简写形式
        watch:{
                ishost(newValue, oldValue) {
                    console.log(newValue, old)
                }
            }
            1.前提：配置项中只有handler(){}函数，没有其他deep，immediate等其他属性时候，可以简写
 -->

<body>
    <div id="root"></div>
    <script>
        Vue.config.productionTip = false; //以阻止vue在启动时生成生产提示
        const Vm = new Vue({
            el: "#root",
            data: {
                ishost: true
            },
            computed: {
                info() {
                    return ishost ? "炎热" : "寒冷"
                }
            },
            watch: {
                ishost(newValue, oldValue) {
                    console.log(newValue, old)
                }
            }
        })
    </script>

</body>

</html>